// Author: wsyear
// Problem: T354614 数数(metem)
// Contest: Luogu
// Memory Limit: 512 MB
// Time Limit: 1000 ms
// 
// Powered by CP Editor (https://cpeditor.org)

#include <bits/stdc++.h>
#ifdef dbg
#define D(...) fprintf(stderr, __VA_ARGS__)
#define DD(...) D(#__VA_ARGS__ " = "), debug_helper::debug(__VA_ARGS__), D("\n")
#include "C:\Users\wsyear\Desktop\OI\templates\debug.hpp"
#else
#define D(...) ((void)0)
#define DD(...) ((void)0)
#endif
#define rep(i, j, k) for (int i = (j); i <= (k); ++i)
#define per(i, j, k) for (int i = (j); i >= (k); --i)
#define SZ(v) int((v).size())
#define ALL(v) (v).begin(),(v).end()
#define fi first
#define se second
#define gc getchar
#define pc putchar
using ll = long long;
using pii = std::pair<int, int>;
using pll = std::pair<ll, ll>;

using namespace std;

namespace IO {
const int SIZ = 1 << 14;

inline char getc() {
    static char bf[SIZ], *begin = bf, *end = bf;
    if (begin == end) begin = bf, end = bf + fread(bf, 1, SIZ, stdin);
    if (begin == end) return EOF;
    return *begin++;
}
char wbf[SIZ], *wend = wbf, *weoo = wbf + SIZ;
inline void putc(char c) {
    *wend = c, ++wend;
    if (wend == weoo) fwrite(wbf, 1, SIZ, stdout), wend = wbf;
}
inline void do_flush() { fwrite(wbf, 1, wend - wbf, stdout); }
template <typename T>
inline void uread(T &ans) {
    static char tmp;
    tmp = getc(), ans = 0;
    while (!isdigit(tmp)) tmp = getc();
    while (isdigit(tmp))
        ans = (ans << 1) + (ans << 3) + (tmp ^ 48), tmp = getc();
}
template <typename T>
inline void read(T &ans) {
    static char tmp2;
    static bool flag;
    tmp2 = getc(), ans = 0, flag = 0;
    while (!isdigit(tmp2)) {
        if (tmp2 == '-') flag = 1;
        tmp2 = getc();
    }
    while (isdigit(tmp2))
        ans = (ans << 1) + (ans << 3) + (tmp2 ^ 48), tmp2 = getc();
    if (flag) ans = -ans;
}
template <typename T>
inline void uwrite(T x) {
    if (x > 9) uwrite(x / 10);
    putc(x % 10 + '0');
}
template <typename T>
inline void write(T x) {
    if (x < 0)
        putc('-'), uwrite(-x);
    else
        uwrite(x);
}
inline void putstr(const char str[]) {
    for (int i = 0; str[i]; i++) putc(str[i]);
}
inline void readalpha(char &x) {
    for (x = getc(); !isalpha(x); x = getc())
        ;
}
inline void readstr(char str[]) {
    char c;
    while (isspace(c = getc()))
        ;
    int cnt = 0;
    while (!isspace(c) && c != EOF) str[++cnt] = c, c = getc();
    str[++cnt] = 0;
}
};  // namespace IO
using IO::read, IO::write, IO::do_flush, IO::putc, IO::uread, IO::uwrite;

template <int P>
class mod_int {
  using Z = mod_int;

private:
  static int mo(int x) { return x < 0 ? x + P : x; }

public:
  int x;
  int val() const { return x; }
  mod_int() : x(0) {}
  template <class T>
  mod_int(const T &x_) : x(x_ >= 0 && x_ < P ? static_cast<int>(x_) : mo(static_cast<int>(x_ % P))) {}
  bool operator==(const Z &rhs) const { return x == rhs.x; }
  bool operator!=(const Z &rhs) const { return x != rhs.x; }
  Z operator-() const { return Z(x ? P - x : 0); }
  Z pow(long long k) const {
    Z res = 1, t = *this;
    while (k) {
      if (k & 1) res *= t;
      if (k >>= 1) t *= t;
    }
    return res;
  }
  Z &operator++() {
    x < P - 1 ? ++x : x = 0;
    return *this;
  }
  Z &operator--() {
    x ? --x : x = P - 1;
    return *this;
  }
  Z operator++(int) {
    Z ret = x;
    x < P - 1 ? ++x : x = 0;
    return ret;
  }
  Z operator--(int) {
    Z ret = x;
    x ? --x : x = P - 1;
    return ret;
  }
  Z inv() const { return pow(P - 2); }
  Z &operator+=(const Z &rhs) {
    (x += rhs.x) >= P && (x -= P);
    return *this;
  }
  Z &operator-=(const Z &rhs) {
    (x -= rhs.x) < 0 && (x += P);
    return *this;
  }
  Z &operator*=(const Z &rhs) {
    x = 1ULL * x * rhs.x % P;
    return *this;
  }
  Z &operator/=(const Z &rhs) { return *this *= rhs.inv(); }
#define setO(T, o)                                 \
  friend T operator o(const Z &lhs, const Z &rhs) {\
    Z res = lhs;                                   \
    return res o## = rhs;                          \
  }
  setO(Z, +) setO(Z, -) setO(Z, *) setO(Z, /)
#undef setO
};
const int P = 998244353;
using Z = mod_int<P>;

const int N = 2000010;

int n, k, a[N];
Z fac[N], ivf[N];

Z binom(int x, int y) {
  if (x < 0 || y < 0 || x < y) return 0;
  return fac[x] * ivf[x - y] * ivf[y];
}

Z calc(int x, int y) {
  return binom(x + y - 1, y - 1);
}

int main() {
  freopen("count.in", "r", stdin);
  freopen("count.out", "w", stdout);
  fac[0] = 1;
  rep (i, 1, N - 1) fac[i] = fac[i - 1] * i;
  ivf[N - 1] = fac[N - 1].inv();
  per (i, N - 1, 1) ivf[i - 1] = ivf[i] * i;
  read(n), read(k);
  rep (i, 1, n) read(a[i]);
  Z res = 0;
  rep (i, 1, n - 1) res += calc(i, k - 1);
  res += calc(n, k - 1) - calc(n, k - a[1]);
  if (n == 1) res += 1;
  rep (i, 2, n) {
    if (a[i] < a[i - 1]) break;
    res += calc(n - i + 1, k - a[i - 1]) - calc(n - i + 1, k - a[i]);
    if (i == n) res += 1;
  }
  write(res.val()), putc(10);
  do_flush();
}